home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
tic-ta1a
/
form1.frm
next >
Wrap
Text File
|
1999-10-11
|
7KB
|
229 lines
VERSION 5.00
Begin VB.Form Main
BorderStyle = 0 'None
Caption = "Tic-Tac-Toe v0.X"
ClientHeight = 3000
ClientLeft = 0
ClientTop = 0
ClientWidth = 3000
Icon = "Form1.frx":0000
LinkTopic = "Form1"
Picture = "Form1.frx":014A
ScaleHeight = 3000
ScaleWidth = 3000
StartUpPosition = 2 'CenterScreen
Begin VB.Label YPoints
BackStyle = 0 'Transparent
Caption = "=0"
Height = 240
Left = 630
TabIndex = 4
Top = 2655
Width = 300
End
Begin VB.Label XPoints
BackStyle = 0 'Transparent
Caption = "=0"
Height = 255
Left = 285
TabIndex = 3
Top = 2460
Width = 240
End
Begin VB.Label About_Label
BackStyle = 0 'Transparent
Height = 240
Left = 2400
TabIndex = 2
Top = 90
Width = 240
End
Begin VB.Image ImageX
Height = 390
Left = 2490
Picture = "Form1.frx":1EB4
Top = 2640
Width = 375
End
Begin VB.Image image0
Height = 390
Left = 1995
Picture = "Form1.frx":21A7
Top = 2655
Width = 375
End
Begin VB.Image Spot
Height = 390
Index = 8
Left = 2055
Picture = "Form1.frx":24A0
Top = 2010
Width = 375
End
Begin VB.Image Spot
Height = 390
Index = 7
Left = 1290
Picture = "Form1.frx":2799
Top = 2040
Width = 375
End
Begin VB.Image Spot
Height = 390
Index = 6
Left = 630
Picture = "Form1.frx":2A92
Top = 2040
Width = 375
End
Begin VB.Image Spot
Height = 390
Index = 5
Left = 1950
Picture = "Form1.frx":2D8B
Top = 1380
Width = 375
End
Begin VB.Image Spot
Height = 390
Index = 4
Left = 1245
Picture = "Form1.frx":3084
Top = 1395
Width = 375
End
Begin VB.Image Spot
Height = 390
Index = 3
Left = 600
Picture = "Form1.frx":337D
Top = 1440
Width = 375
End
Begin VB.Image Spot
Height = 390
Index = 2
Left = 1815
Picture = "Form1.frx":3676
Top = 750
Width = 375
End
Begin VB.Image Spot
Height = 390
Index = 1
Left = 1170
Picture = "Form1.frx":396F
Top = 810
Width = 375
End
Begin VB.Image Spot
Height = 390
Index = 0
Left = 555
Picture = "Form1.frx":3C68
Top = 825
Width = 375
End
Begin VB.Label Minimize_Label
BackStyle = 0 'Transparent
Height = 240
Left = 2100
TabIndex = 1
Top = 90
Width = 240
End
Begin VB.Label Exit_Label
BackStyle = 0 'Transparent
Height = 240
Left = 2670
TabIndex = 0
Top = 75
Width = 240
End
End
Attribute VB_Name = "Main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Turn As Byte 'player turn 1=O 5=X
Private Sub About_Label_Click()
MsgBox "TIC-TAC-TOE" + vbCrLf + "Simple Code" + vbCrLf + "For anyone to use and abuse" + vbCrLf + vbCrLf + "JosΘ Machado" + vbCrLf + "a.k.a. MacMadMan" + vbCrLf + "Contact me: jose.machado@virtualazores.com" + vbCrLf + vbCrLf + ":) ENJOY (:"
End Sub
Private Sub Exit_Label_Click()
Unload Me
Unload WinnerMessage
End Sub
Private Sub clear_spots()
Dim i As Integer
For i = 0 To 8
Set Spot(i).Picture = Nothing
Spot(i).Tag = 0
Next i
End Sub
Private Sub Form_Load()
image0.Visible = False
ImageX.Visible = False
Load WinnerMessage
clear_spots
End Sub
Private Sub Minimize_Label_Click()
Me.WindowState = vbMinimized
End Sub
Private Sub Spot_Click(Index As Integer)
If Turn = 1 Then
If Spot(Index).Tag = 0 Then
Spot(Index).Tag = 1
Spot(Index).Picture = image0.Picture
Turn = 2
checkwinner
End If
Else
If Spot(Index).Tag = 0 Then
Spot(Index).Tag = 5
Spot(Index).Picture = ImageX.Picture
Turn = 1
checkwinner
End If
End If
End Sub
Private Sub checkwinner()
With Spot
If (.Item(0).Tag = 5 And .Item(1).Tag = 5 And .Item(2).Tag = 5) Or _
(.Item(3).Tag = 5 And .Item(4).Tag = 5 And .Item(5).Tag = 5) Or _
(.Item(6).Tag = 5 And .Item(7).Tag = 5 And .Item(8).Tag = 5) Or _
(.Item(0).Tag = 5 And .Item(3).Tag = 5 And .Item(6).Tag = 5) Or _
(.Item(1).Tag = 5 And .Item(4).Tag = 5 And .Item(7).Tag = 5) Or _
(.Item(2).Tag = 5 And .Item(5).Tag = 5 And .Item(8).Tag = 5) Or _
(.Item(0).Tag = 5 And .Item(4).Tag = 5 And .Item(8).Tag = 5) Or _
(.Item(2).Tag = 5 And .Item(4).Tag = 5 And .Item(6).Tag = 5) Then
WinnerMessage.Label2 = "One more to 'X'"
WinnerMessage.Show 1
XPoints = "=" & Val(Mid(XPoints, 2)) + 1
clear_spots
Else
If (.Item(0).Tag = 1 And .Item(1).Tag = 1 And .Item(2).Tag = 1) Or _
(.Item(3).Tag = 1 And .Item(4).Tag = 1 And .Item(5).Tag = 1) Or _
(.Item(6).Tag = 1 And .Item(7).Tag = 1 And .Item(8).Tag = 1) Or _
(.Item(0).Tag = 1 And .Item(3).Tag = 1 And .Item(6).Tag = 1) Or _
(.Item(1).Tag = 1 And .Item(4).Tag = 1 And .Item(7).Tag = 1) Or _
(.Item(2).Tag = 1 And .Item(5).Tag = 1 And .Item(8).Tag = 1) Or _
(.Item(0).Tag = 1 And .Item(4).Tag = 1 And .Item(8).Tag = 1) Or _
(.Item(2).Tag = 1 And .Item(4).Tag = 1 And .Item(6).Tag = 1) Then
WinnerMessage.Label2 = "One more to '0'"
WinnerMessage.Show 1
YPoints = "=" & Val(Mid(YPoints, 1)) + 1
clear_spots
End If
End If
End With
End Sub